<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: TT
  Date: 2020/9/3
  Time: 14:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
   <script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
    <link rel="stylesheet" href="css/index2.css">
    <script type="text/javascript">
           function del(sid) {
               $.post("del.do",{"sid":sid},function (number) {
                   if (number>0){
                       alert("删除成功");
                   }else {
                       alert("删除失败");
                   }
                   location="list.do";
               },"json");
           }
           function xq1(sid) {
            location="xq.jsp?sid="+sid;
           }
    </script>
</head>
<body>
<center><h1>歌曲列表</h1></center>
<a href="add.jsp">添加</a>
<a href="phb.jsp">评分排行榜</a>
    <table>
        <tr>
            <td colspan="10">
                <form action="list.do" method="post">
                    发布时间<input type="date" name="itime1" value="${itime1}">~
                    <input type="date" name="itime2" value="${itime2}">
                    <input type="submit" value="查询">
                </form>
            </td>
        </tr>
        <tr>
            <th>编号</th>
            <th>歌曲名</th>
            <th>来源</th>
            <th>发布时间</th>
            <th>歌曲评分</th>
            <th>文件</th>
            <th>歌手</th>
            <th>操作</th>
        </tr>
        <c:forEach items="${plist.list}" var="a">
            <tr>
                <td>${a.sid}</td>
                <td>${a.sname}</td>
                <td>${a.scome}</td>
                <td>${a.itime}</td>
                <td>${a.score}</td>
                <td><img src="${a.photo}" width="50" height="50" alt="文件已逃跑"></td>
                <td>
                    <c:forEach items="${a.clist}" var="s">
                        ${s.cname}
                    </c:forEach>
                </td>
                <td>
                    <a href="xz.do?down=${a.photo}">下载</a>
                    <input type="button" value="详情" onclick="xq1(${a.sid})">
                    <input type="button" value="删除" onclick="del(${a.sid})">
                    <a href="pf.jsp?sid=${a.sid}">评分</a>
                </td>
            </tr>
        </c:forEach>
        <tr>
            <td colspan="10">
                当前在${plist.pageNum}/${plist.pages}页，一共有${plist.total}条数据<br>
                <a href="list.do?pageNum=${plist.firstPage}">首页</a>
                <a href="list.do?pageNum=${plist.prePage}">上一页</a>
                <a href="list.do?pageNum=${plist.nextPage}">下一页</a>
                <a href="list.do?pageNum=${plist.lastPage}">末页</a>
            </td>
        </tr>
    </table>
</body>
</html>
